#include "stdafx.h"
#include "ylLogMessageGroup.h"
#include "ylLogMessage.h"
#include "ylLogMessageTemplate.h"

using namespace yoctolog_viewer;

void LogMessageGroup::AddMessage(LogMessage ^pMsg)
{
	unsigned int uiMsgID = pMsg->m_uiID;
	LogMessageClass ^pClass = pMsg->m_pTemplate->m_pMessageClass;

	m_vecMessageList->Add(uiMsgID);
	if( !m_mapClassCounts.ContainsKey(pClass) )
	{
		m_mapClassCounts.Add(pClass, 0);
	}
	++m_mapClassCounts[pClass];

	if( OnMessageAdded )
	{
		OnMessageAdded->Invoke(uiMsgID);
	}
}